package com.adong.tx;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author adong
 */
@Service
public class TxService {
    @Autowired
    private TxDao txDao;

    //添加事务管理
    @Transactional
    public void insert() {
        txDao.insert();
        //模拟异常
        int x = 10 / 0;
    }
}
